//
//  WBUserInfoModel.m
//  sinaWeibo
//
//  Created by 李江波 on 2016/11/15.
//  Copyright © 2016年 lijiangbo. All rights reserved.
//

#import "WBUserInfoModel.h"

@implementation WBUserInfoModel

-(instancetype)initWithUserInfoModel:(NSDictionary *)dict{

    if (self = [super init]) {
        
        [self setValuesForKeysWithDictionary:dict];
        
    }
    return self;
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
}

-(void)setExpires_in:(double)expires_in{

    _expires_in = expires_in;
    
    self.expires_date = [NSDate dateWithTimeIntervalSinceNow:expires_in];
    
}

//解档
-(instancetype)initWithCoder:(NSCoder *)aDecoder{

    if (self = [super init]) {
        
        self.access_token = [aDecoder decodeObjectForKey:@"access_token"];
        self.expires_date = [aDecoder decodeObjectForKey:@"expires_date"];
        self.uid = [aDecoder decodeObjectForKey:@"uid"];
        self.name = [aDecoder decodeObjectForKey:@"name"];
        self.avatar_large = [aDecoder decodeObjectForKey:@"avatar_large"];
    }
    return self;
}

//存档
-(void)encodeWithCoder:(NSCoder *)aCoder{

    [aCoder encodeObject:self.access_token forKey:@"access_token"];
    [aCoder encodeObject:self.expires_date forKey:@"expires_date"];
    [aCoder encodeObject:self.uid forKey:@"uid"];
    [aCoder encodeObject:self.name forKey:@"name"];
    [aCoder encodeObject:self.avatar_large forKey:@"avatar_large"];
    
}


@end
